//共享数据
bus = new Vue({
    data() {
        return {
            //折叠状态
            collapse: false,
        }
    },
    watch: {
        collapse(collapse) {
            this.collapseChange();
            localStorage.setItem("menu_collapse", collapse)
        }
    },
    methods: {
        collapseChange() {
            const contentBox = document.getElementById("content-box");
            this.collapse ? contentBox.classList.add('content-collapse') : contentBox.classList.remove('content-collapse');
        },
        getInitCollapse() {
            const menuCollapse = localStorage.getItem("menu_collapse");
            if (!menuCollapse) {
                return false;
            }
            return menuCollapse !== "false";
        }
    },
    computed: {},
    created() {
        this.collapse = this.getInitCollapse();
        this.collapseChange();
    }
});